package com.zs.backend.modules.orderLog.controller;


import com.zs.backend.common.api.CommonResult;
import com.zs.backend.modules.orderLog.dto.OrderLogResponse;
import com.zs.backend.modules.orderLog.service.OrderLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import java.io.IOException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 订单记录表 前端控制器
 * </p>
 *
 * @author zs
 * @since 2024-03-25
 */
@RestController
@Api(tags = "订单记录：订单打款审核记录、打款申请记录、回款记录")
@RequestMapping("/orderLog")
public class OrderLogController {

    @Autowired
    private OrderLogService orderLogService;

    @ApiOperation("根据订单id、操作类型查看记录")
    @GetMapping("/query/{orderId}/{type}")
    public CommonResult<OrderLogResponse> queryLog(
        @ApiParam(value = "订单id", name = "orderId", required = true)
        @PathVariable Long orderId,
        @ApiParam(value = "订单记录类型（1：订单打款审核2：打款申请记录3：回款记录）", name = "type", required = true)
        @PathVariable Integer type) {
        OrderLogResponse orderLogResponse = orderLogService.queryLogByType(type, orderId);
        return CommonResult.success(orderLogResponse);
    }

}

